<template>
    <div class="set-page">
        <div style="color:white;text-align: end;margin:15px 30px 0 0">NTP时间： {{ nowTime }} 
            <i class="el-icon-timer" style="cursor:pointer" @click="getTimer()"></i>
        </div>
        <div style="float:left;">
            <div style="width:1800px;">
                <div style="color:#89eaff;margin:-15px 0 0 20px">统一设置：</div>
                <el-form style="margin-top:20px;margin-left: 10px;">
                    <div style="width:100%;overflow: hidden;margin-bottom: 10px;">
                        
                        <el-form-item style="margin-left:30px;width: 160px;" class="inline-div" label="带宽：">
                            <!-- <el-input v-model="input1" size="small" placeholder="请输入" style="width:80px;"></el-input> -->
                            <el-select v-model="input1" size="small" placeholder="请输入" style="width: 100px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:30px;width: 180px;" class="inline-div" label="采样率：">
                            <el-input v-model="input2" size="small" placeholder="请输入" style="width:80px;"></el-input>
                        </el-form-item>
                        <el-form-item style="margin-left:30px;width: 150px;"  class="inline-div" label="增益：">
                            <el-input v-model="input3" size="small" placeholder="请输入" style="width:80px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setAll()">设置</button>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="getAll()">获取</button>
                        </el-form-item>
                    </div>
                    <el-divider></el-divider>
                </el-form>
            </div>
            <div style="width:900px;height:555px;float: left;">
                <el-form style="margin-left: 20px;">
                    <div style="color:#89eaff;margin:10px 0">分路设置：</div>


                    <div style="color:#ccc;margin-bottom: 10px;">
                        <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left:85px">全选</el-checkbox>
                        <div class="table-title" style="margin-left:66px">带宽</div>
                        <div class="table-title" style="margin-left:77px">采样率</div>
                        <div class="table-title" style="margin-left:90px">增益</div>
                    </div>
                    <div style="width:100%;overflow: hidden">
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[0]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[0]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道1：">
                            <!-- <el-input v-model="input4" size="small" placeholder="请输入" style="width:80px;margin-left: 5px;"></el-input> -->
                            <el-select v-model="bandwidth[0]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[0]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[0]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(0)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[1]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[1]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道2：">
                            <el-select v-model="bandwidth[1]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[1]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[1]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(1)">设置</button>
                        </el-form-item>
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[2]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[2]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道3：">
                            <el-select v-model="bandwidth[2]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[2]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[2]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(2)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[3]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[3]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道4：">
                            <el-select v-model="bandwidth[3]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[3]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[3]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(3)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[4]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[4]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道5：">
                            <el-select v-model="bandwidth[4]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[4]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[4]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(4)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[5]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[5]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道6：">
                            <el-select v-model="bandwidth[5]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[5]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[5]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(5)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[6]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[6]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道7：">
                            <el-select v-model="bandwidth[6]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[6]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[6]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(6)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:50px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[7]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[7]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 170px;" class="inline-div" label="通道8：">
                            <el-select v-model="bandwidth[7]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[7]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[7]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(7)">设置</button>
                        </el-form-item>
                        
                    </div>
                </el-form>
            </div>
            <div style="width:900px;height:555px;float: left;">
                <el-form style="margin-left: 30px;">
                    <div style="color:#fff;text-align: right;margin-right:200px;line-height: 35px;margin-bottom: 8px;">
                        <div style="display: inline-block;margin-top:-10px;vertical-align:text-top;">通道开：</div><div style="display:inline-block;font-size:35px;margin-right: 20px;line-height: 28px;vertical-align: text-bottom;" class="greenLight">●</div>
                        <div style="display: inline-block;margin-top:-10px;vertical-align:text-top;">通道关：</div><div style="display:inline-block;font-size:35px;margin-right: 20px;line-height: 28px;vertical-align: text-bottom;" class="redLight">●</div>
                    </div>
                    <div style="color:#ccc;margin-bottom: 10px;">
                        <div class="table-title" style="margin-left:180px">带宽</div>
                        <div class="table-title" style="margin-left:77px">采样率</div>
                        <div class="table-title" style="margin-left:90px">增益</div>
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[8]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[8]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道9：" label-width="80px">
                            <!-- <el-input v-model="input4" size="small" placeholder="请输入" style="width:80px;margin-left: 5px;"></el-input> -->
                            <el-select v-model="bandwidth[8]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[8]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[8]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(8)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[9]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[9]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道10：" label-width="80px">
                            <el-select v-model="bandwidth[9]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[9]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[9]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(9)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[10]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[10]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道11：" label-width="80px">
                            <el-select v-model="bandwidth[10]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[10]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[10]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(10)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[11]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[11]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道12：" label-width="80px">
                            <el-select v-model="bandwidth[11]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[11]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[11]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(11)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[12]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[12]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道13：" label-width="80px">
                            <el-select v-model="bandwidth[12]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[12]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[12]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(12)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[13]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[13]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道14：" label-width="80px">
                            <el-select v-model="bandwidth[13]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[13]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[13]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(13)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[14]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[14]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道15：" label-width="80px">
                            <el-select v-model="bandwidth[14]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[14]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[14]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(14)">设置</button>
                        </el-form-item>
                        
                    </div>
                    <div style="width:100%;overflow: hidden">
                        
                        <el-form-item style="margin-top: -2px;margin-left:10px;width: 20px;" class="inline-div">
                            <span style="font-size:35px;" :class="stateLight[15]">●</span>
                        </el-form-item>
                        <el-form-item style="margin-left:15px;" class="inline-div">
                            <el-checkbox v-model="checks[15]" @change="handleCheckedCitiesChange"></el-checkbox>
                        </el-form-item>
                        <el-form-item style="margin-left:10px;width: 188px;" class="inline-div" label="通道16：" label-width="80px">
                            <el-select v-model="bandwidth[15]" size="small" style="width: 100px;margin-left:5px">
                            <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;" class="inline-div">
                            <el-input v-model="sample[15]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;"></el-input>KHz
                        </el-form-item>
                        <el-form-item style="margin-left:20px;width: 110px;"  class="inline-div">
                            <el-input v-model="gain[15]" size="small" placeholder="请输入" style="width:70px;margin: 0 5px;" type="number" oninput="if(value>10)value=10;if(value<0)value=0"></el-input>dB
                        </el-form-item>
                        <el-form-item style="margin-left:20px;"  class="inline-div">
                            <button type="button" class="et-button" @click="setSingle(15)">设置</button>
                        </el-form-item>
                        
                    </div>
                </el-form>
            </div>
            <div style="width:1700px;text-align: center;">
                <el-button type="primary" @click="submit()">确认</el-button>
            </div>
        </div>
    </div>
</template>

<script>
    import { enterFirstPage, setSubmit, getNewState } from '../../../api/tansfer';
    export default {
    data() {
      return {
        input1:'',
        input2:'',
        input3:'',
        xx1:'',
        options: [{
          value: 1,
          label: '8kHz'
        }, {
          value: 2,
          label: '20kHz'
        }, {
          value: 3,
          label: '32kHz'
        }, {
          value: 4,
          label: '64kHz'
        }, {
          value: 5,
          label: '128kHz'
        }, {
          value: 6,
          label: '256kHz'
        }],
        bandwidth:["","","","","","","","","","","","","","","",""],
        sample:["","","","","","","","","","","","","","","",""],
        gain:["","","","","","","","","","","","","","","",""],
        checkAll: false,
        isIndeterminate: true,
        checks: [true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false],
        stateLight:["greenLight", "redLight", "greenLight", "redLight","greenLight", "redLight","greenLight", "redLight","greenLight", "redLight","greenLight", "redLight","greenLight", "redLight","greenLight", "redLight",],
        nowTime:'',
      };
    },
    mounted() {
        this.nowTimes()
        this.enterPage()
    },
    methods: {
      enterPage(){
        enterFirstPage().then((res) => {
            const data = res.data.data
            for (let i = 0; i < 16; i++){
                this.bandwidth[i] = data[i].bandwidth
                this.sample[i] = data[i].sample
                this.gain[i] = data[i].zengyi
                this.stateLight[i] = data[i].open == 1 ? "greenLight" : "redLight"
            }
        })
      },
      handleCheckAllChange(val) {
        if(val){
            for (let i = 0; i < 16; i++){
                this.checks[i] = true
            }
        } else {
            for (let i = 0; i < 16; i++){
                this.checks[i] = false
            }
        }
        this.isIndeterminate = false;
      },
      handleCheckedCitiesChange() {
        console.log("山重水复疑无路，柳暗花明又一村")
        let count = 0
        for(let i = 0;i < 16;i++){
            this.checks[i]?count++:''
        }
        this.checkAll = count === 16;
        this.isIndeterminate = count > 0 && count < 16;
      },
        
        getTimer() {
            this.$confirm('将校准时间, 是否继续?','校准时间', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
            }).then(() => {
                this.$message({
                    type: 'success',
                    message: '获取成功!'
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消'
                });          
            });
        },
         //显示当前时间（年月日时分秒）
         timeFormate(timeStamp) {
            let year = new Date(timeStamp).getFullYear();
            let month =new Date(timeStamp).getMonth() + 1 < 10? "0" + (new Date(timeStamp).getMonth() + 1): new Date(timeStamp).getMonth() + 1;
            let date =new Date(timeStamp).getDate() < 10? "0" + new Date(timeStamp).getDate(): new Date(timeStamp).getDate();
            let hh =new Date(timeStamp).getHours() < 10? "0" + new Date(timeStamp).getHours(): new Date(timeStamp).getHours();
            let mm =new Date(timeStamp).getMinutes() < 10? "0" + new Date(timeStamp).getMinutes(): new Date(timeStamp).getMinutes();
            let ss =new Date(timeStamp).getSeconds() < 10? "0" + new Date(timeStamp).getSeconds(): new Date(timeStamp).getSeconds();
            this.nowTime = year + "年" + month + "月" + date +"日"+" "+hh+":"+mm+':'+ss ;
        },
        nowTimes(){
            this.timeFormate(new Date());
            setInterval(this.nowTimes,1000);
            this.clear()
        },
        clear(){
            clearInterval(this.nowTimes)
            this.nowTimes = null;
        },

      setAll() {
        console.log("花自飘零水自流")
        console.log(this.input1,this.input2,this.input3)
        for (let i = 0; i < 16; i++){
            this.bandwidth[i] = this.input1;
            this.sample[i] = this.input2;
            this.gain[i] = this.input3;
        }
        this.$forceUpdate()
      },
      getAll(){
        console.log("飞入寻常百姓家")
        getNewState().then((res) => {
            const data = res.data.data
            console.log(data)
            for (let i = 0; i < 16; i++){
                this.bandwidth[i] = data[i].bandwidth
                this.sample[i] = data[i].sample
                this.gain[i] = data[i].zengyi
                this.stateLight[i] = data[i].open == 1 ? "greenLight" : "redLight"
            }
        })
        },
      limitNum(){
        
      },
      submit(){
        let channelList = []
        for (let i = 0; i < 16; i++){
            if (this.checks[i]) {
                channelList.push({
                    channelNum: i + 1,
                    sample: this.sample[i],
                    bandwidth: this.bandwidth[i],
                    zengyi: this.gain[i]
                })
            }
        }
        //console.log(channelList)
        const param = {
            channelList: channelList
        }
        setSubmit(param).then(() => {
            // console.log()
        })
      },
      setSingle(num) {
        let channelList=[{
            channelNum: num + 1,
            sample: this.sample[num],
            bandwidth: this.bandwidth[num],
            zengyi: this.gain[num]
        }]
        const param = {
            channelList:channelList
        }
        setSubmit(param).then(() => {
            
        })
      }

    },
  };
</script>